package com.example.demo.design.template_method.salary_deliver;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import lombok.Getter;
import lombok.Setter;

/**
 * @Author: liull
 * @Description:(2) MyDate类包含: * private成员变量year,month,day : toDateString(方法返回日期对应的字符串: xxxx年xx月xx日
 * @Date: Created in 17:31 2020/11/14
 * @Modified By:
 */
@Getter
@Setter
public class MyDate {
    private int year, month, day;

    public MyDate() {
    }

    public MyDate(int year, int month, int day) {
        this.year = year;
        this.month = month;
        this.day = day;
    }

    public String toDateString() {
        DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
        return LocalDateTime.of(year, month, day, 0, 0).format(pattern);
    }
}
